Repository Public
1import { getFilm, relatedFilms } from "@/lib/films";2import { bad, json, localeOf } from "@/lib/api";34/** GET /api/films/:slug — public metadata and provenance. Prompts and costs are never part of this payload. */5export async function GET(req: Request, ctx: { params: Promise<{ slug: string }> }) {6 const locale = localeOf(new URL(req.url));7 const film = await getFilm(locale, (await ctx.params).slug);8 if (!film) return bad("not_found", 404);9 const related = await relatedFilms(locale, film);10 const { _embedding, ...pub } = film;11 void _embedding;12 return json({ film: pub, related: related.map((r) => ({ slug: r.film.slug, title: r.film.title, reason: r.reason })) });13}14